package me.magicall.db.sql.select;

import me.magicall.db.sql.SqlElementTemplate;
import me.magicall.db.sql.table.Column;

/**
 * 一个order by条件
 * 
 * @author MaGiCalL
 */
public class OneOrder extends SqlElementTemplate {

	private Column field;
	private DbOrder dbOrder;

	public OneOrder(final Column field, final DbOrder dbOrders) {
		super();
		this.field = field;
		dbOrder = dbOrders;
	}

	public OneOrder(final Column field) {
		this(field, DbOrder.DESC);
	}

	public OneOrder() {
		super();
	}

	@Override
	public StringBuilder appendTo(final StringBuilder sb) {
		return getDbOrder().appendTo(getField().appendTo(sb));
	}

	public Column getField() {
		return field;
	}

	public void setField(final Column field) {
		this.field = field;
	}

	public DbOrder getDbOrder() {
		return dbOrder;
	}

	public void setDbOrder(final DbOrder dbOrder) {
		this.dbOrder = dbOrder;
	}
}
